package com.cytui.starter;

import com.cuiyt.start.DemoUserService;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: cuiyutian1
 * @date: 2021/10/3 14:32
 * @description:
 */
@Configuration
@EnableConfigurationProperties(UserProperties.class)
public class UserAutoConfiguration {

    @Bean
    public DemoUserService getBean(UserProperties userProperties) {
        //创建组件实例
        DemoUserService userService = new DemoUserService();
        userService.setUsername(userProperties.getUsername());
        userService.setPassword(userProperties.getPassword());
        return userService;
    }
}
